import axios from 'axios'
import store from '@/store'

const request = axios.create({
    baseURL: 'https://mallapi.duyiedu.com/goods/',
    timeout: 4000
})

request.interceptors.request.use(config => {
    config.params = { ...config.params, appkey: store.state.appkey }
    return config
})

request.interceptors.response.use(
    resp => resp.data,
    err => {
        return Promise.reject(err)
    }
)

export default request;